package org.example.framework.protocol.http;

import org.example.framework.Invocation;
import org.example.framework.Invoker;
import org.example.framework.ServerUrl;

/**
 * @author shenguangyang
 */
public class HttpInvoker implements Invoker {
    private final ServerUrl serverUrl;

    public HttpInvoker(ServerUrl serverUrl) {
        this.serverUrl = serverUrl;
    }

    @Override
    public Object invoke(Invocation invocation) {
        return new HttpClient().send(serverUrl.getHostname(), serverUrl.getPort(), invocation);
    }
}
